﻿using System;
using System.Threading;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using BrainTechLLC.Communications;
using BrainTechLLC.ThreadSafeObjects;
using BrainTechLLC.EmlenMud.Communication;

namespace WpfImageBroadcaster
{
	/// <summary>
	/// Handles incoming messages received by the server
	/// </summary>
	public class ServerMessageHandler : IIncomingMessageHandler
	{
		public static int _messagesReceived = 0;

		public void HandleIncomingMessage(ICommIncomingConnection connection, ICommunicationsMessage message)
		{
			Interlocked.Increment(ref _messagesReceived);

			// We could also use the "type" parameter integer and avoid reflection/etc
			Type messageType = message.MessageContents.GetType();

			Console.WriteLine("Unknown command type: " + messageType.Name);
		}		
	}	
}


